import { createApp } from "vue";
import App from "./App.vue";
// reset style sheet
import "@/styles/reset.scss";
// CSS common style sheet
import "@/styles/common.scss";
// iconfont css
import "@/assets/iconfont/iconfont.scss";
// font css
import "@/assets/fonts/font.scss";
// element css
import "element-plus/dist/index.css";
// element dark css
import "element-plus/theme-chalk/dark/css-vars.css";
// custom element dark css
import "@/styles/element-dark.scss";
// custom element css
import "@/styles/element.scss";
// svg icons
import "virtual:svg-icons-register";
// element plus
import ElementPlus from "element-plus";
// element icons
import * as Icons from "@element-plus/icons-vue";
// custom directives
import directives from "@/directives/index";
// vue Router
import router from "@/routers";
// vue i18n
import I18n from "@/languages/index";
// pinia store
import pinia from "@/stores";
// errorHandler
import errorHandler from "@/utils/errorHandler";
// tsparticles
import Particles from "@tsparticles/vue3";
import { loadSlim } from "@tsparticles/slim";
// initVWheelScale
// import { initVWheelScale } from "@/assets/json/vWheelScale.js";
// v3-drag-zoom 组件
import V3DragZoom from "v3-drag-zoom";
// v3-drag-zoom 全局样式（必须导入，否则无法正常使用）
import "v3-drag-zoom/dist/style.css";
//引入图片懒加载插件
import Lazyload from "vue3-lazyload";

const app = createApp(App);

// initVWheelScale(app);
//注册插件
app.use(Lazyload, {
  loading: "@/assets/images/default.png", //可以指定加载中的图像
  error: "@/assets/images/err.png" //可以指定加载失败的图像
});

app.config.errorHandler = errorHandler;

// register the element Icons component
Object.keys(Icons).forEach(key => {
  app.component(key, Icons[key as keyof typeof Icons]);
});

app.use(Particles as any, {
  init: async (engine: any) => {
    await loadSlim(engine);
  }
});

app.use(ElementPlus).use(directives).use(router).use(I18n).use(pinia).use(V3DragZoom).mount("#app");
